package NewTablePanels;

import javax.swing.*;

public class NewTripTable extends JPanel {

	private JPanel leftPart;
	private JPanel rightPart;
	
	private JLabel priceLabel;
	private JLabel departureLocationLabel;
	private JLabel arrivalLocationLabel;
	private JLabel departureTimeLabel;
	private JLabel arrivalTimeLabel;
	private JLabel flightsLabel;
	private JLabel tripIDLabel;
	
	private JTextField priceField;
	private JTextField departureLocationField;
	private JTextField arrivalLocationField;
	private JTextField departureTimeField;
	private JTextField arrivalTimeField;
	private JTextField flightsField;
	private JTextField tripIDField;
	
	public NewTripTable()
	{
		priceLabel = new JLabel("Price: ");
		departureLocationLabel = new JLabel("Departure Location: ");
		arrivalLocationLabel = new JLabel("Arrival Location: ");
		departureTimeLabel = new JLabel("Departure Time: ");
		arrivalTimeLabel = new JLabel("Arrival Time: ");
		flightsLabel = new JLabel("Flight: ");
		tripIDLabel = new JLabel("Trip-ID: ");
		
		priceField = new JTextField(20);
		departureLocationField = new JTextField(20);
		arrivalLocationField = new JTextField(20);
		departureTimeField = new JTextField(20);
		arrivalTimeField = new JTextField(20);
		flightsField = new JTextField(20);
		tripIDField = new JTextField(20);
		
		leftPart = new JPanel();
		rightPart = new JPanel();
		
		leftPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		rightPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		fillLeftPart();
		fillRightPart();
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		this.add(leftPart);
		this.add(rightPart);
		this.setVisible(false);
	}
	
	private void fillLeftPart()
	{
		leftPart.add(priceLabel);
		leftPart.add(departureLocationLabel);
		leftPart.add(arrivalLocationLabel);
		leftPart.add(departureTimeLabel);
		leftPart.add(arrivalTimeLabel);
		leftPart.add(flightsLabel);
		leftPart.add(tripIDLabel);
	}
	
	private void fillRightPart()
	{
		rightPart.add(priceField);
		rightPart.add(departureLocationField);
		rightPart.add(arrivalLocationField);
		rightPart.add(departureTimeField);
		rightPart.add(arrivalTimeField);
		rightPart.add(flightsField);
		rightPart.add(tripIDField);
	}
}
